package com.xiang.api.config.MyConfig;

import com.xiang.api.Util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
// @EnableConfigurationProperties
public class Login {

  @Value("${server.port}")
  public String port;

  public String key;

  public void setKey(String key) {

    if (key == null || key.length() < 16) {
      this.key = Util.randString(16);
    } else {
      this.key = key.length() > 16 ? key.substring(0, 16) : key;
    }
  }

  public String getKey() {
    return key;
  }

  public void setPort(String port) {
    this.port = port;
  }

  public String getPort() {
    return port;
  }

  @Override
  public String toString() {
    return super.toString();
  }

}
